package com.ruibang.glass.quality.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDate;
import java.util.List;

/**
 * @Author: songJinKang
 * @CreateTime: 2023-08-30  13:49
 * @Description: TODO:缺陷组
 * @Version: 1.0
 */

@Data
@TableName("g_defect_group")
public class DefectGroup {
    @ApiModelProperty("缺陷组id")
    @TableId(value = "defect_group_id", type = IdType.ASSIGN_UUID)
    private String defectGroupId;

    @ApiModelProperty("缺陷组名称")
    @NotBlank(message = "缺陷组名称不可为空")
    private String defectGroupName;

    @ApiModelProperty("检查机名称")
    @NotBlank(message = "检查机名称不可为空")
    private String checkMachineName;

    @ApiModelProperty("检查机code")
    @NotBlank(message = "检查机不可为空")
    private String checkMachineCode;

    @ApiModelProperty("检查机类型")
    @Size(min = 0, max = 1, message = "检查机类型0:冷端(成品1)，1:热端（半成品0）")
    private String checkMachineType;

    @ApiModelProperty("生效时间")
    @NotNull(message = "生效时间不可为空")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JSONField(format = "yyyy-MM-dd")
    private LocalDate takingEffectTime;

    @ApiModelProperty("缺陷")
    @TableField(exist = false)
    private List<Defect> defects;
}
